package com.github.lee.mvvm.core.startup

import android.content.Context
import android.util.Log
import androidx.startup.Initializer
import com.tencent.smtt.export.external.TbsCoreSettings
import com.tencent.smtt.sdk.QbSdk

class X5WebViewInitializer : Initializer<Any> {

    override fun create(context: Context): Any {

        Log.e("TTTTYYYY","初始化X5")

        val params = HashMap<String, Any>()
        params[TbsCoreSettings.TBS_SETTINGS_USE_SPEEDY_CLASSLOADER] = true
        params[TbsCoreSettings.TBS_SETTINGS_USE_DEXLOADER_SERVICE] = true
        QbSdk.initTbsSettings(params)

        QbSdk.initX5Environment(context, object : QbSdk.PreInitCallback {
            override fun onCoreInitFinished() {
                Log.e("TAG", "Init X5 finished")
            }

            override fun onViewInitFinished(success: Boolean) {
                Log.e("TAG", "Init X5 finished is success : $success")
            }
        })

        return ""
    }

    override fun dependencies(): MutableList<Class<out Initializer<*>>> {
        return mutableListOf()
    }


}